Page({
  data: {
    avatarList: [{
        url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png'
      },
      {
        url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png'
      },
      {
        url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png'
      }
    ],

    value: 0,
    range: [{
        value: 0,
        text: "热度"
      },

      {
        value: 1,
        text: "时间"
      },

      {
        value: 2,
        text: "时长"
      }
    ],


    isTypeTag: 'qb',
    tabs: [{
        lable: '全部',
        value: 'qb'
      },

      {
        lable: '公开课',
        value: 'gkk'
      },

      {
        lable: '定制课',
        value: 'dzk'
      },

      {
        lable: '普通课',
        value: 'ptk'
      }
    ]
  },
  onLoad: function () {
    var that = this;
    that.getCourse()
  },
  getCourse() {
    var that = this;
    wx.request({
      url: 'http://114.132.161.50:8083/course/list',
      method: 'POST', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
      // header: {}, // 设置请求的 header
      header: {
        'content-type': 'application/json'
      },
      data: { //参数
        num: '0'
      },
      success: function (res) {
        if (res.statusCode == 200) {
          that.setData({
            course: res.data,
          })
          console.log(res.data)
        }
      },
      fail: function () {
        wx.showToast({
          title: "网络连接失败",
          duration: 3000
        })

      },
    })
  },
  change: function change(e) {
    console.log("e:", e);
  },
  //tab切换
  handelTabtoShow: function handelTabtoShow(item, index) {
    // this.pageNum=1

    this.isTypeTag = item.value;


    // this.getUserList()



  },
  handleBack() {
    wx.navigateBack({
      delta: 2
    })
  }
})
